//不要给我WA WA 叫
//一定AC
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iomanip>
#include <climits>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 2e5 + 10;

void solve()
{
    int maxn[6];//存储每一行的最大值
    memset(maxn,INT_MIN,sizeof(maxn));
    int minn[6] = {N,N,N,N,N,N};
    int a[6][6];
    for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
            cin >> a[i][j];
        }
    }
     for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
            if(a[i][j] > maxn[i])
            {
                maxn[i] = a[i][j];
            }
        }
       //cout << maxn[i] << endl;
    }
    for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
           // cout << a[j][i] << " " << minn[i] << endl;
            if(a[j][i] < minn[i]) 
            {
                minn[i] = a[j][i];
            }
        }
         //cout << minn[i] << endl;
    }
    
    for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
            if(a[i][j] == maxn[i] && a[i][j] == minn[j])
            {
                 cout << i << " " << j << " " << a[i][j] << endl;
                 return;
            }
        }
    }
    cout << "not found" << endl;
    
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    while(t -- )  solve();
    return 0;
}
